enableremote: Support --json and --json-error-messages
authorJoey Hess <joeyh@joeyh.name>
Wed, 10 May 2023 18:09:27 +0000 (14:09 -0400)
committerJoey Hess <joeyh@joeyh.name>
Wed, 10 May 2023 18:09:27 +0000 (14:09 -0400)
Seems unlikely to be too useful, but who knows. Was trivial anyway.

Sponsored-By: the NIH-funded NICEMAN (ReproNim TR&D3) project
CHANGELOG
Command/EnableRemote.hs
doc/git-annex-enableremote.mdwn
doc/todo/--json_for_unannex__and_ideally_any_other_command_.mdwn

index fd30b986acefb9a2dc26a731c84ee5334b3e0e82..2c3fc9a8f4370edfeb2f8b20acef257f0105d5e6 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -37,11 +37,11 @@ git-annex (10.20230408) UNRELEASED; urgency=medium
     of core.sharedRepository and umask.
   * initremote: Avoid creating a remote that is not encrypted when gpg is
     broken.
-  * Support --json and --json-error-messages in more commands
-    (addunused, dead, describe, dropunused, expire, fix, importfeed, init,
-    initremote, log, merge, migrate, reinit, reinject, rekey, renameremote,
-    rmurl, semitrust, setpresentkey, trust, unannex, undo, untrust, unused,
-    upgrade)
+  * Support --json and --json-error-messages in many more commands
+    (addunused, dead, describe, dropunused, enableremote, expire, fix,
+    importfeed, init, initremote, log, merge, migrate, reinit, reinject,
+    rekey, renameremote, rmurl, semitrust, setpresentkey, trust, unannex,
+    undo, untrust, unused, upgrade)
   * log: When --raw-date is used, display only seconds from the epoch, as
     documented, omitting a trailing "s" that was included in the output
     before.
index d28a9818424dd25eb133b4e9ba017dd69684b53a..9f364c19c91db2e67edad6b274eb18681707433e 100644 (file)
@@ -30,10 +30,11 @@ import Git.Config
 import qualified Data.Map as M
 
 cmd :: Command
-cmd = command "enableremote" SectionSetup
-       "enables git-annex to use a remote"
-       (paramPair paramName $ paramOptional $ paramRepeating paramParamValue)
-       (withParams seek)
+cmd = withAnnexOptions [jsonOptions] $
+       command "enableremote" SectionSetup
+               "enables git-annex to use a remote"
+               (paramPair paramName $ paramOptional $ paramRepeating paramParamValue)
+               (withParams seek)
 
 seek :: CmdParams -> CommandSeek
 seek = withWords (commandAction . start)
index 3f07fabb7695e65ef006d0529f533a46b1216c44..bcc6728183a0efc5a8abeee73db36a59f8110c30 100644 (file)
@@ -59,10 +59,17 @@ has found didn't work before and gave up on using, setting
 
 # OPTIONS
 
-Most options are not prefixed by a dash, and set parameters of the remote,
-as shown above. 
+* `--json`
 
-Also, the [[git-annex-common-options]](1) can be used.
+  Enable JSON output. This is intended to be parsed by programs that use
+  git-annex.
+
+* `--json-error-messages`
+
+  Messages that would normally be output to standard error are included in
+  the JSON instead.
+
+* Also, the [[git-annex-common-options]](1) can be used.
 
 # SEE ALSO
 
index fef97c334563f5fb11e909606af5d17018ff95a3..6b748c1146500f9f2460868d8bb778cbd364692c 100644 (file)
@@ -40,11 +40,11 @@ These commands have been updated to support --json:
 * git-annex-merge
 * git-annex-upgrade
 * git-annex-initremote
+* git-annex-enableremote
 
 Provisional list of commands that don't support --json and maybe should:
 
 * git-annex-configremote
-* git-annex-enableremote
 
 These commands could support json, but I punted: